﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using Tradex.Market;

namespace Tradex.Tests.Market {
    /// <summary>
    /// Summary description for InstrumentPricingItemTests
    /// </summary>
    [TestClass]
    public class InstrumentPricingItemTests {

        /// <summary>
        ///A test for InstrumentPricingItem Constructor
        ///</summary>
        [TestMethod()]
        public void Constructor_String_1() {
            const string codedPricing = "[/]:0.25/2";
            InstrumentPricingItem target = new InstrumentPricingItem(codedPricing);
            Assert.AreEqual(codedPricing, target.ToString());
        }

        /// <summary>
        ///A test for InstrumentPricingItem Constructor
        ///</summary>
        [TestMethod()]
        public void Constructor_String_2() {
            const string codedPricing = "[-0.25/]:0.25/2";
            InstrumentPricingItem target = new InstrumentPricingItem(codedPricing);
            Assert.AreEqual(codedPricing, target.ToString());
        }


        /// <summary>
        ///A test for InstrumentPricingItem Constructor
        ///</summary>
        [TestMethod()]
        public void Constructor_String_3() {
            const string codedPricing = "[/0.25]:0.25/2";
            InstrumentPricingItem target = new InstrumentPricingItem(codedPricing);
            Assert.AreEqual(codedPricing, target.ToString());
        }

        /// <summary>
        ///A test for InstrumentPricingItem Constructor
        ///</summary>
        [TestMethod()]
        public void Constructor_String_4() {
            const string codedPricing = "[-0.25/0.25]:0.25/2";
            InstrumentPricingItem target = new InstrumentPricingItem(codedPricing);
            Assert.AreEqual(codedPricing, target.ToString());
        }

        /// <summary>
        ///A test for InstrumentPricingItem Constructor
        ///</summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void Constructor_Null() {
            const string codedPricing = null;
            InstrumentPricingItem target = new InstrumentPricingItem(codedPricing);
        }

        /// <summary>
        ///A test for InstrumentPricingItem Constructor
        ///</summary>
        [TestMethod()]
        public void Constructor_Values() {
            const double minimumPrice = Double.NegativeInfinity;
            const double maximumPrice = Double.PositiveInfinity;
            const double increment = 0.25d;
            const byte precision = 2;
            InstrumentPricingItem target = new InstrumentPricingItem(minimumPrice, maximumPrice, increment, precision);
            Assert.AreEqual(Double.NegativeInfinity, target.MinimumPrice);
            Assert.AreEqual(Double.PositiveInfinity, target.MaximumPrice);
            Assert.AreEqual(0.25d, target.Increment);
            Assert.AreEqual(2, target.Precision);
            Assert.AreEqual("[/]:0.25/2", target.ToString());
        }

        /// <summary>
        ///A test for InstrumentPricingItem Constructor
        ///</summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void Constructor_Values_1() {
            const double minimumPrice = Double.PositiveInfinity;
            const double maximumPrice = Double.PositiveInfinity;
            const double increment = 0.25d;
            const byte precision = 2;
            InstrumentPricingItem target = new InstrumentPricingItem(minimumPrice, maximumPrice, increment, precision);
        }

        /// <summary>
        ///A test for InstrumentPricingItem Constructor
        ///</summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void Constructor_Values_2() {
            const double minimumPrice = Double.NegativeInfinity;
            const double maximumPrice = Double.NegativeInfinity;
            const double increment = 0.25d;
            const byte precision = 2;
            InstrumentPricingItem target = new InstrumentPricingItem(minimumPrice, maximumPrice, increment, precision);
        }

        /// <summary>
        ///A test for InstrumentPricingItem Constructor
        ///</summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void Constructor_Values_3() {
            const double minimumPrice = 0.25d;
            const double maximumPrice = -0.25d;
            const double increment = 0.25d;
            const byte precision = 2;
            InstrumentPricingItem target = new InstrumentPricingItem(minimumPrice, maximumPrice, increment, precision);
        }

        /// <summary>
        ///A test for InstrumentPricingItem Constructor
        ///</summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void Constructor_Values_4() {
            const double minimumPrice = Double.NaN;
            const double maximumPrice = 0.25d;
            const double increment = 0.25d;
            const byte precision = 2;
            InstrumentPricingItem target = new InstrumentPricingItem(minimumPrice, maximumPrice, increment, precision);
        }

        /// <summary>
        ///A test for InstrumentPricingItem Constructor
        ///</summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void Constructor_Values_5() {
            const double minimumPrice = -0.25d;
            const double maximumPrice = Double.NaN;
            const double increment = 0.25d;
            const byte precision = 2;
            InstrumentPricingItem target = new InstrumentPricingItem(minimumPrice, maximumPrice, increment, precision);
        }

    }
}
